﻿namespace HRM.CORE.Process
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Grid;
    using APP.HELPER;
    using HRM.CORE;
    
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using Dictionary.ERP;
    using APP.HELPER.Utils.Language;
    using Security.ERP;

    public class xucSalaryAdd : Common.xucBaseAddH
    {
        private CalcEdit calBasicSalary;
        private CalcEdit calCoefficient;
        private CalcEdit calInsuranceSalary;
        private CalcEdit calMinimumSalary;
        private CalcEdit calOldBasicSalary;
        private CalcEdit calOldCoefficientSalary;
        private CalcEdit calOldInsuranceSalary;
        private CalcEdit calOldMinimumSalary;
        private CalcEdit calOldPayMoney;
        private CalcEdit calPayMoney;
        private TextEdit cboDecideNumber;
        private ComboBoxEdit cboOldPayForm;
        private ComboBoxEdit cboOldStepSalary;
        private ComboBoxEdit cboPayForm;
        private TextEdit cboPerson;
        private ComboBoxEdit cboStepSalary;
        private GridColumn colEmployeeCode;
        private GridColumn colFirstName;
        private GridColumn colLastName;
        private GridColumn colRankCode;
        private GridColumn colRankName;
        private IContainer components = null;
        private DateEdit dtDate;
        private GridLookUpEdit glkEmployeeCode;
        private GridLookUpEdit glkOldRankSalary;
        private GridLookUpEdit glkRankSalary;
        private GridColumn gridColumn1;
        private GridColumn gridColumn2;
        private GridView gridLookUpEdit1View;
        private GridView gridView1;
        private GridView gridView7;
        private GroupControl grInformation;
        private GroupBox grNew;
        private GroupBox grOld;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl4;
        private LabelControl labelControl5;
        private LabelControl labelControl6;
        private LabelControl labelControl7;
        private LabelControl lcBasicSalaryNew;
        private LabelControl lcBasicSalaryOld;
        private LabelControl lcCoefficientNew;
        private LabelControl lcCoefficientOld;
        private LabelControl lcDate;
        private LabelControl lcDecideNumber;
        private LabelControl lcMinimumSalaryNew;
        private LabelControl lcMinimumSalaryOld;
        private LabelControl lcPerson;
        private LabelControl lcRankNew;
        private LabelControl lcRankOld;
        private LabelControl lcReason;
        private LabelControl lcStepNew;
        private LabelControl lcStepOld;
        private string m_EmployeeCode = "";
        private Guid m_SalaryID = Guid.Empty;
        private TextEdit txtEmployeeName;
        private MemoEdit txtReason;

        public event SuccessEventHander Success;

        public xucSalaryAdd()
        {
            this.InitializeComponent();
            this.InitMultiLanguages();
            this.InitComponent();
            this.InitData();
        }

        protected override void Add()
        {
            base.Add();
            this.LoadEmployeeSalary();
        }

        private void calNewPayMoney_EditValueChanged(object sender, EventArgs e)
        {
            this.calBasicSalary.EditValue = this.calPayMoney.EditValue;
            this.calInsuranceSalary.EditValue = this.calPayMoney.EditValue;
        }

        private void cboNewPayForm_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cboPayForm.SelectedIndex == 0)
            {
                this.calPayMoney.Enabled = false;
                this.glkRankSalary.Enabled = true;
                this.cboStepSalary.Enabled = true;
                this.calInsuranceSalary.EditValue = this.calBasicSalary.EditValue;
            }
            else
            {
                this.calPayMoney.Enabled = true;
                this.glkRankSalary.Enabled = false;
                this.cboStepSalary.Enabled = false;
                this.calInsuranceSalary.EditValue = this.calPayMoney.EditValue;
            }
        }

        private void cboStepSalary_EditValueChanged(object sender, EventArgs e)
        {
            DIC_SALARY_STEP dic_salary_step = new DIC_SALARY_STEP();
            dic_salary_step.Get(this.cboStepSalary.Text, this.glkRankSalary.EditValue.ToString());
            this.calCoefficient.EditValue = dic_salary_step.Coefficient;
            this.calBasicSalary.EditValue = double.Parse(this.calCoefficient.Text) * double.Parse(this.calMinimumSalary.Text);
            this.calInsuranceSalary.EditValue = this.calBasicSalary.EditValue;
        }

        public void Clear()
        {
            this.txtReason.Text = "";
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void glkEmployeeCode_EditValueChanged(object sender, EventArgs e)
        {
            this.m_EmployeeCode = this.glkEmployeeCode.EditValue.ToString();
            this.LoadEmployeeInformation();
            this.LoadEmployeeSalary();
        }

        private void glkRankSalary_EditValueChanged(object sender, EventArgs e)
        {
            DIC_SALARY_STEP dic_salary_step = new DIC_SALARY_STEP();
            dic_salary_step.AddComboEditByRank(this.cboStepSalary, this.glkRankSalary.EditValue.ToString());
            dic_salary_step.Get(this.cboStepSalary.Text, this.glkRankSalary.EditValue.ToString());
            this.calCoefficient.EditValue = dic_salary_step.Coefficient;
            this.calBasicSalary.EditValue = double.Parse(this.calCoefficient.Text) * double.Parse(this.calMinimumSalary.Text);
            this.calInsuranceSalary.EditValue = this.calBasicSalary.EditValue;
        }

        private void grInformation_Paint(object sender, PaintEventArgs e)
        {
        }

        protected override void Init()
        {
        }

        private void InitComponent()
        {
            this.dtDate.DateTime = DateTime.Now;
        }

        private void InitData()
        {
            new HRM_EMPLOYEE().AddGridLookupEdit(this.glkEmployeeCode);
            DIC_SALARY_RANK dic_salary_rank = new DIC_SALARY_RANK();
            dic_salary_rank.AddGridLookupEdit(this.glkRankSalary);
            dic_salary_rank.AddGridLookupEdit(this.glkOldRankSalary);
            DIC_MINIMUMSALARY dic_minimumsalary = new DIC_MINIMUMSALARY();
            dic_minimumsalary.Get();
            this.calMinimumSalary.EditValue = dic_minimumsalary.Money;
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xucSalaryAdd));
            this.grInformation = new GroupControl();
            this.labelControl1 = new LabelControl();
            this.txtEmployeeName = new TextEdit();
            this.glkEmployeeCode = new GridLookUpEdit();
            this.gridLookUpEdit1View = new GridView();
            this.dtDate = new DateEdit();
            this.lcDate = new LabelControl();
            this.grNew = new GroupBox();
            this.labelControl7 = new LabelControl();
            this.calInsuranceSalary = new CalcEdit();
            this.labelControl5 = new LabelControl();
            this.calPayMoney = new CalcEdit();
            this.labelControl6 = new LabelControl();
            this.cboPayForm = new ComboBoxEdit();
            this.lcBasicSalaryNew = new LabelControl();
            this.calMinimumSalary = new CalcEdit();
            this.lcMinimumSalaryNew = new LabelControl();
            this.calBasicSalary = new CalcEdit();
            this.lcCoefficientNew = new LabelControl();
            this.calCoefficient = new CalcEdit();
            this.lcStepNew = new LabelControl();
            this.lcRankNew = new LabelControl();
            this.glkRankSalary = new GridLookUpEdit();
            this.gridView7 = new GridView();
            this.cboStepSalary = new ComboBoxEdit();
            this.grOld = new GroupBox();
            this.labelControl4 = new LabelControl();
            this.calOldInsuranceSalary = new CalcEdit();
            this.labelControl3 = new LabelControl();
            this.calOldPayMoney = new CalcEdit();
            this.labelControl2 = new LabelControl();
            this.cboOldPayForm = new ComboBoxEdit();
            this.lcBasicSalaryOld = new LabelControl();
            this.lcMinimumSalaryOld = new LabelControl();
            this.lcCoefficientOld = new LabelControl();
            this.lcStepOld = new LabelControl();
            this.lcRankOld = new LabelControl();
            this.calOldMinimumSalary = new CalcEdit();
            this.calOldBasicSalary = new CalcEdit();
            this.calOldCoefficientSalary = new CalcEdit();
            this.glkOldRankSalary = new GridLookUpEdit();
            this.gridView1 = new GridView();
            this.cboOldStepSalary = new ComboBoxEdit();
            this.lcReason = new LabelControl();
            this.lcDecideNumber = new LabelControl();
            this.lcPerson = new LabelControl();
            this.cboDecideNumber = new TextEdit();
            this.cboPerson = new TextEdit();
            this.txtReason = new MemoEdit();
            this.colEmployeeCode = new GridColumn();
            this.colFirstName = new GridColumn();
            this.colLastName = new GridColumn();
            this.colRankCode = new GridColumn();
            this.colRankName = new GridColumn();
            this.gridColumn1 = new GridColumn();
            this.gridColumn2 = new GridColumn();
            ((ISupportInitialize) base.Err).BeginInit();
            base.imageCollection2.BeginInit();
            this.grInformation.BeginInit();
            this.grInformation.SuspendLayout();
            this.txtEmployeeName.Properties.BeginInit();
            this.glkEmployeeCode.Properties.BeginInit();
            this.gridLookUpEdit1View.BeginInit();
            this.dtDate.Properties.VistaTimeProperties.BeginInit();
            this.dtDate.Properties.BeginInit();
            this.grNew.SuspendLayout();
            this.calInsuranceSalary.Properties.BeginInit();
            this.calPayMoney.Properties.BeginInit();
            this.cboPayForm.Properties.BeginInit();
            this.calMinimumSalary.Properties.BeginInit();
            this.calBasicSalary.Properties.BeginInit();
            this.calCoefficient.Properties.BeginInit();
            this.glkRankSalary.Properties.BeginInit();
            this.gridView7.BeginInit();
            this.cboStepSalary.Properties.BeginInit();
            this.grOld.SuspendLayout();
            this.calOldInsuranceSalary.Properties.BeginInit();
            this.calOldPayMoney.Properties.BeginInit();
            this.cboOldPayForm.Properties.BeginInit();
            this.calOldMinimumSalary.Properties.BeginInit();
            this.calOldBasicSalary.Properties.BeginInit();
            this.calOldCoefficientSalary.Properties.BeginInit();
            this.glkOldRankSalary.Properties.BeginInit();
            this.gridView1.BeginInit();
            this.cboOldStepSalary.Properties.BeginInit();
            this.cboDecideNumber.Properties.BeginInit();
            this.cboPerson.Properties.BeginInit();
            this.txtReason.Properties.BeginInit();
            base.SuspendLayout();
            base.btnSave.Location = new Point(0x125, 0x175);
            base.btnSave.TabIndex = 1;
            base.btnCancel.Location = new Point(0x1ec, 0x175);
            base.btnCancel.TabIndex = 3;
            base.btnSaveNew.Location = new Point(0x187, 0x175);
            base.btnSaveNew.TabIndex = 2;
            base.imageCollection2.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection2.ImageStream");
            this.grInformation.Controls.Add(this.labelControl1);
            this.grInformation.Controls.Add(this.txtEmployeeName);
            this.grInformation.Controls.Add(this.glkEmployeeCode);
            this.grInformation.Controls.Add(this.dtDate);
            this.grInformation.Controls.Add(this.lcDate);
            this.grInformation.Controls.Add(this.grNew);
            this.grInformation.Controls.Add(this.grOld);
            this.grInformation.Controls.Add(this.lcReason);
            this.grInformation.Controls.Add(this.lcDecideNumber);
            this.grInformation.Controls.Add(this.lcPerson);
            this.grInformation.Controls.Add(this.cboDecideNumber);
            this.grInformation.Controls.Add(this.cboPerson);
            this.grInformation.Controls.Add(this.txtReason);
            this.grInformation.Dock = DockStyle.Top;
            this.grInformation.Location = new Point(0, 0);
            this.grInformation.Name = "grInformation";
            this.grInformation.Size = new Size(0x257, 0x16b);
            this.grInformation.TabIndex = 0;
            this.grInformation.Text = "Th\x00f4ng Tin Thay Đổi Lương";
            this.grInformation.Paint += new PaintEventHandler(this.grInformation_Paint);
            this.labelControl1.AllowHtmlString = true;
            this.labelControl1.Location = new Point(15, 0x20);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(0x60, 14);
            this.labelControl1.TabIndex = 0;
            this.labelControl1.Text = "Chọn nh\x00e2n vi\x00ean <color=red>(*)</color>:";
            this.txtEmployeeName.Enabled = false;
            this.txtEmployeeName.Location = new Point(0xe9, 0x1d);
            this.txtEmployeeName.Name = "txtEmployeeName";
            this.txtEmployeeName.Size = new Size(0xaf, 20);
            this.txtEmployeeName.TabIndex = 2;
            this.glkEmployeeCode.Location = new Point(0x75, 0x1d);
            this.glkEmployeeCode.Name = "glkEmployeeCode";
            this.glkEmployeeCode.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.glkEmployeeCode.Properties.NullText = "[Chọn nh\x00e2n vi\x00ean]";
            this.glkEmployeeCode.Properties.View = this.gridLookUpEdit1View;
            this.glkEmployeeCode.Size = new Size(110, 20);
            this.glkEmployeeCode.TabIndex = 1;
            this.glkEmployeeCode.EditValueChanged += new EventHandler(this.glkEmployeeCode_EditValueChanged);
            this.gridLookUpEdit1View.Columns.AddRange(new GridColumn[] { this.colEmployeeCode, this.colFirstName, this.colLastName });
            this.gridLookUpEdit1View.FocusRectStyle = DrawFocusRectStyle.RowFocus;
            this.gridLookUpEdit1View.Name = "gridLookUpEdit1View";
            this.gridLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridLookUpEdit1View.OptionsView.ShowAutoFilterRow = true;
            this.gridLookUpEdit1View.OptionsView.ShowGroupPanel = false;
            this.dtDate.EditValue = null;
            this.dtDate.Location = new Point(0xff, 0x14f);
            this.dtDate.Name = "dtDate";
            this.dtDate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.dtDate.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.dtDate.Size = new Size(90, 20);
            this.dtDate.TabIndex = 10;
            this.lcDate.Location = new Point(0xb3, 0x152);
            this.lcDate.Name = "lcDate";
            this.lcDate.Size = new Size(0x47, 13);
            this.lcDate.TabIndex = 9;
            this.lcDate.Text = "Ng\x00e0y thay đổi:";
            this.grNew.Controls.Add(this.labelControl7);
            this.grNew.Controls.Add(this.calInsuranceSalary);
            this.grNew.Controls.Add(this.labelControl5);
            this.grNew.Controls.Add(this.calPayMoney);
            this.grNew.Controls.Add(this.labelControl6);
            this.grNew.Controls.Add(this.cboPayForm);
            this.grNew.Controls.Add(this.lcBasicSalaryNew);
            this.grNew.Controls.Add(this.calMinimumSalary);
            this.grNew.Controls.Add(this.lcMinimumSalaryNew);
            this.grNew.Controls.Add(this.calBasicSalary);
            this.grNew.Controls.Add(this.lcCoefficientNew);
            this.grNew.Controls.Add(this.calCoefficient);
            this.grNew.Controls.Add(this.lcStepNew);
            this.grNew.Controls.Add(this.lcRankNew);
            this.grNew.Controls.Add(this.glkRankSalary);
            this.grNew.Controls.Add(this.cboStepSalary);
            this.grNew.Location = new Point(0x12e, 0x37);
            this.grNew.Name = "grNew";
            this.grNew.Size = new Size(0x11d, 0xd7);
            this.grNew.TabIndex = 4;
            this.grNew.TabStop = false;
            this.grNew.Text = "Mới";
            this.labelControl7.Location = new Point(6, 0xbd);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new Size(0x4d, 13);
            this.labelControl7.TabIndex = 14;
            this.labelControl7.Text = "Lương đ\x00f3ng BH:";
            int[] bits = new int[4];
            this.calInsuranceSalary.EditValue = new decimal(bits);
            this.calInsuranceSalary.Location = new Point(0x59, 0xba);
            this.calInsuranceSalary.Name = "calInsuranceSalary";
            this.calInsuranceSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calInsuranceSalary.Properties.Appearance.Options.UseFont = true;
            this.calInsuranceSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calInsuranceSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calInsuranceSalary.Size = new Size(0xb5, 20);
            this.calInsuranceSalary.TabIndex = 15;
            this.labelControl5.Location = new Point(11, 0x31);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new Size(0x36, 13);
            this.labelControl5.TabIndex = 2;
            this.labelControl5.Text = "Mức lương:";
            this.calPayMoney.Location = new Point(0x59, 0x2e);
            this.calPayMoney.Name = "calPayMoney";
            this.calPayMoney.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calPayMoney.Properties.DisplayFormat.FormatString = "{0}";
            this.calPayMoney.Properties.EditFormat.FormatString = "{0}";
            this.calPayMoney.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calPayMoney.Size = new Size(0xb6, 20);
            this.calPayMoney.TabIndex = 3;
            this.calPayMoney.EditValueChanged += new EventHandler(this.calNewPayMoney_EditValueChanged);
            this.labelControl6.Location = new Point(10, 0x16);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new Size(0x4b, 13);
            this.labelControl6.TabIndex = 0;
            this.labelControl6.Text = "Trả lương theo:";
            this.cboPayForm.Location = new Point(0x59, 20);
            this.cboPayForm.Name = "cboPayForm";
            this.cboPayForm.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboPayForm.Properties.Items.AddRange(new object[] { "<Theo hệ số lương>", "<Theo mức lương>" });
            this.cboPayForm.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            this.cboPayForm.Size = new Size(0xb6, 20);
            this.cboPayForm.TabIndex = 1;
            this.cboPayForm.SelectedIndexChanged += new EventHandler(this.cboNewPayForm_SelectedIndexChanged);
            this.lcBasicSalaryNew.Location = new Point(8, 0xa1);
            this.lcBasicSalaryNew.Name = "lcBasicSalaryNew";
            this.lcBasicSalaryNew.Size = new Size(0x45, 13);
            this.lcBasicSalaryNew.TabIndex = 12;
            this.lcBasicSalaryNew.Text = "Lương cơ bản:";
            bits = new int[4];
            this.calMinimumSalary.EditValue = new decimal(bits);
            this.calMinimumSalary.Location = new Point(0x59, 0x81);
            this.calMinimumSalary.Name = "calMinimumSalary";
            this.calMinimumSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calMinimumSalary.Properties.Appearance.Options.UseFont = true;
            this.calMinimumSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calMinimumSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calMinimumSalary.Properties.ReadOnly = true;
            this.calMinimumSalary.Size = new Size(0xb5, 20);
            this.calMinimumSalary.TabIndex = 11;
            this.lcMinimumSalaryNew.Location = new Point(8, 0x84);
            this.lcMinimumSalaryNew.Name = "lcMinimumSalaryNew";
            this.lcMinimumSalaryNew.Size = new Size(0x4c, 13);
            this.lcMinimumSalaryNew.TabIndex = 10;
            this.lcMinimumSalaryNew.Text = "Lương tối thiểu:";
            bits = new int[4];
            this.calBasicSalary.EditValue = new decimal(bits);
            this.calBasicSalary.Location = new Point(0x59, 0x9e);
            this.calBasicSalary.Name = "calBasicSalary";
            this.calBasicSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calBasicSalary.Properties.Appearance.Options.UseFont = true;
            this.calBasicSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calBasicSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calBasicSalary.Properties.ReadOnly = true;
            this.calBasicSalary.Size = new Size(0xb5, 20);
            this.calBasicSalary.TabIndex = 13;
            this.lcCoefficientNew.Location = new Point(8, 0x68);
            this.lcCoefficientNew.Name = "lcCoefficientNew";
            this.lcCoefficientNew.Size = new Size(0x3d, 13);
            this.lcCoefficientNew.TabIndex = 8;
            this.lcCoefficientNew.Text = "Hệ số lương:";
            bits = new int[4];
            this.calCoefficient.EditValue = new decimal(bits);
            this.calCoefficient.Location = new Point(0x59, 0x65);
            this.calCoefficient.Name = "calCoefficient";
            this.calCoefficient.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calCoefficient.Properties.Appearance.Options.UseFont = true;
            this.calCoefficient.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calCoefficient.Properties.ReadOnly = true;
            this.calCoefficient.Size = new Size(0xb6, 20);
            this.calCoefficient.TabIndex = 9;
            this.lcStepNew.Location = new Point(0xb7, 0x4b);
            this.lcStepNew.Name = "lcStepNew";
            this.lcStepNew.Size = new Size(0x15, 13);
            this.lcStepNew.TabIndex = 6;
            this.lcStepNew.Text = "Bậc:";
            this.lcRankNew.Location = new Point(10, 0x4b);
            this.lcRankNew.Name = "lcRankNew";
            this.lcRankNew.Size = new Size(0x40, 13);
            this.lcRankNew.TabIndex = 4;
            this.lcRankNew.Text = "Ngạch lương:";
            this.glkRankSalary.Location = new Point(0x59, 0x48);
            this.glkRankSalary.Name = "glkRankSalary";
            this.glkRankSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.glkRankSalary.Properties.NullText = "[Chọn ngạch lương]";
            this.glkRankSalary.Properties.PopupSizeable = false;
            this.glkRankSalary.Properties.View = this.gridView7;
            this.glkRankSalary.Size = new Size(0x57, 20);
            this.glkRankSalary.TabIndex = 5;
            this.glkRankSalary.EditValueChanged += new EventHandler(this.glkRankSalary_EditValueChanged);
            this.gridView7.Columns.AddRange(new GridColumn[] { this.colRankCode, this.colRankName });
            this.gridView7.FocusRectStyle = DrawFocusRectStyle.RowFocus;
            this.gridView7.Name = "gridView7";
            this.gridView7.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridView7.OptionsView.ShowGroupPanel = false;
            this.cboStepSalary.Location = new Point(210, 0x48);
            this.cboStepSalary.Name = "cboStepSalary";
            this.cboStepSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboStepSalary.Properties.NullText = "[Chọn bậc lương]";
            this.cboStepSalary.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            this.cboStepSalary.Size = new Size(0x3d, 20);
            this.cboStepSalary.TabIndex = 7;
            this.cboStepSalary.EditValueChanged += new EventHandler(this.cboStepSalary_EditValueChanged);
            this.grOld.Controls.Add(this.labelControl4);
            this.grOld.Controls.Add(this.calOldInsuranceSalary);
            this.grOld.Controls.Add(this.labelControl3);
            this.grOld.Controls.Add(this.calOldPayMoney);
            this.grOld.Controls.Add(this.labelControl2);
            this.grOld.Controls.Add(this.cboOldPayForm);
            this.grOld.Controls.Add(this.lcBasicSalaryOld);
            this.grOld.Controls.Add(this.lcMinimumSalaryOld);
            this.grOld.Controls.Add(this.lcCoefficientOld);
            this.grOld.Controls.Add(this.lcStepOld);
            this.grOld.Controls.Add(this.lcRankOld);
            this.grOld.Controls.Add(this.calOldMinimumSalary);
            this.grOld.Controls.Add(this.calOldBasicSalary);
            this.grOld.Controls.Add(this.calOldCoefficientSalary);
            this.grOld.Controls.Add(this.glkOldRankSalary);
            this.grOld.Controls.Add(this.cboOldStepSalary);
            this.grOld.Location = new Point(11, 0x37);
            this.grOld.Name = "grOld";
            this.grOld.Size = new Size(0x11d, 0xd7);
            this.grOld.TabIndex = 3;
            this.grOld.TabStop = false;
            this.grOld.Text = "Hiện tại";
            this.labelControl4.Location = new Point(6, 0xbd);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new Size(0x4d, 13);
            this.labelControl4.TabIndex = 14;
            this.labelControl4.Text = "Lương đ\x00f3ng BH:";
            bits = new int[4];
            this.calOldInsuranceSalary.EditValue = new decimal(bits);
            this.calOldInsuranceSalary.Location = new Point(0x5c, 0xba);
            this.calOldInsuranceSalary.Name = "calOldInsuranceSalary";
            this.calOldInsuranceSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calOldInsuranceSalary.Properties.Appearance.Options.UseFont = true;
            this.calOldInsuranceSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOldInsuranceSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calOldInsuranceSalary.Properties.ReadOnly = true;
            this.calOldInsuranceSalary.Size = new Size(0xb2, 20);
            this.calOldInsuranceSalary.TabIndex = 15;
            this.labelControl3.Location = new Point(11, 0x2f);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new Size(0x36, 13);
            this.labelControl3.TabIndex = 2;
            this.labelControl3.Text = "Mức lương:";
            this.calOldPayMoney.Location = new Point(0x5c, 0x2c);
            this.calOldPayMoney.Name = "calOldPayMoney";
            this.calOldPayMoney.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOldPayMoney.Properties.DisplayFormat.FormatString = "{0}";
            this.calOldPayMoney.Properties.EditFormat.FormatString = "{0}";
            this.calOldPayMoney.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calOldPayMoney.Properties.ReadOnly = true;
            this.calOldPayMoney.Size = new Size(0xb2, 20);
            this.calOldPayMoney.TabIndex = 3;
            this.labelControl2.Location = new Point(10, 20);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(0x4b, 13);
            this.labelControl2.TabIndex = 0;
            this.labelControl2.Text = "Trả lương theo:";
            this.cboOldPayForm.Location = new Point(0x5d, 0x12);
            this.cboOldPayForm.Name = "cboOldPayForm";
            this.cboOldPayForm.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboOldPayForm.Properties.Items.AddRange(new object[] { "<Theo hệ số lương>", "<Theo mức lương>" });
            this.cboOldPayForm.Properties.ReadOnly = true;
            this.cboOldPayForm.Size = new Size(0xb1, 20);
            this.cboOldPayForm.TabIndex = 1;
            this.lcBasicSalaryOld.Location = new Point(9, 0xa2);
            this.lcBasicSalaryOld.Name = "lcBasicSalaryOld";
            this.lcBasicSalaryOld.Size = new Size(0x45, 13);
            this.lcBasicSalaryOld.TabIndex = 12;
            this.lcBasicSalaryOld.Text = "Lương cơ bản:";
            this.lcMinimumSalaryOld.Location = new Point(9, 0x86);
            this.lcMinimumSalaryOld.Name = "lcMinimumSalaryOld";
            this.lcMinimumSalaryOld.Size = new Size(0x4c, 13);
            this.lcMinimumSalaryOld.TabIndex = 10;
            this.lcMinimumSalaryOld.Text = "Lương tối thiểu:";
            this.lcCoefficientOld.Location = new Point(9, 0x68);
            this.lcCoefficientOld.Name = "lcCoefficientOld";
            this.lcCoefficientOld.Size = new Size(0x3d, 13);
            this.lcCoefficientOld.TabIndex = 8;
            this.lcCoefficientOld.Text = "Hệ số lương:";
            this.lcStepOld.Location = new Point(0xbc, 0x4b);
            this.lcStepOld.Name = "lcStepOld";
            this.lcStepOld.Size = new Size(0x15, 13);
            this.lcStepOld.TabIndex = 6;
            this.lcStepOld.Text = "Bậc:";
            this.lcRankOld.Location = new Point(10, 0x4b);
            this.lcRankOld.Name = "lcRankOld";
            this.lcRankOld.Size = new Size(0x40, 13);
            this.lcRankOld.TabIndex = 4;
            this.lcRankOld.Text = "Ngạch lương:";
            bits = new int[4];
            this.calOldMinimumSalary.EditValue = new decimal(bits);
            this.calOldMinimumSalary.Location = new Point(0x5d, 0x83);
            this.calOldMinimumSalary.Name = "calOldMinimumSalary";
            this.calOldMinimumSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calOldMinimumSalary.Properties.Appearance.Options.UseFont = true;
            this.calOldMinimumSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOldMinimumSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calOldMinimumSalary.Properties.ReadOnly = true;
            this.calOldMinimumSalary.Size = new Size(0xb1, 20);
            this.calOldMinimumSalary.TabIndex = 11;
            bits = new int[4];
            this.calOldBasicSalary.EditValue = new decimal(bits);
            this.calOldBasicSalary.Location = new Point(0x5d, 0x9f);
            this.calOldBasicSalary.Name = "calOldBasicSalary";
            this.calOldBasicSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calOldBasicSalary.Properties.Appearance.Options.UseFont = true;
            this.calOldBasicSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOldBasicSalary.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calOldBasicSalary.Properties.ReadOnly = true;
            this.calOldBasicSalary.Size = new Size(0xb1, 20);
            this.calOldBasicSalary.TabIndex = 13;
            bits = new int[4];
            this.calOldCoefficientSalary.EditValue = new decimal(bits);
            this.calOldCoefficientSalary.Location = new Point(0x5c, 0x65);
            this.calOldCoefficientSalary.Name = "calOldCoefficientSalary";
            this.calOldCoefficientSalary.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calOldCoefficientSalary.Properties.Appearance.Options.UseFont = true;
            this.calOldCoefficientSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOldCoefficientSalary.Properties.ReadOnly = true;
            this.calOldCoefficientSalary.Size = new Size(0xb2, 20);
            this.calOldCoefficientSalary.TabIndex = 9;
            this.glkOldRankSalary.Location = new Point(0x5d, 0x48);
            this.glkOldRankSalary.Name = "glkOldRankSalary";
            this.glkOldRankSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.glkOldRankSalary.Properties.NullText = "[Chọn ngạch lương]";
            this.glkOldRankSalary.Properties.PopupSizeable = false;
            this.glkOldRankSalary.Properties.ReadOnly = true;
            this.glkOldRankSalary.Properties.TextEditStyle = TextEditStyles.Standard;
            this.glkOldRankSalary.Properties.View = this.gridView1;
            this.glkOldRankSalary.Size = new Size(0x59, 20);
            this.glkOldRankSalary.TabIndex = 5;
            this.gridView1.Columns.AddRange(new GridColumn[] { this.gridColumn1, this.gridColumn2 });
            this.gridView1.FocusRectStyle = DrawFocusRectStyle.RowFocus;
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.cboOldStepSalary.Location = new Point(0xd7, 0x48);
            this.cboOldStepSalary.Name = "cboOldStepSalary";
            this.cboOldStepSalary.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboOldStepSalary.Properties.NullText = "[Chọn bậc lương]";
            this.cboOldStepSalary.Properties.ReadOnly = true;
            this.cboOldStepSalary.Size = new Size(0x37, 20);
            this.cboOldStepSalary.TabIndex = 7;
            this.lcReason.Location = new Point(15, 0x12a);
            this.lcReason.Name = "lcReason";
            this.lcReason.Size = new Size(0x48, 13);
            this.lcReason.TabIndex = 5;
            this.lcReason.Text = "L\x00fd do thay đổi:";
            this.lcDecideNumber.Location = new Point(15, 0x151);
            this.lcDecideNumber.Name = "lcDecideNumber";
            this.lcDecideNumber.Size = new Size(70, 13);
            this.lcDecideNumber.TabIndex = 7;
            this.lcDecideNumber.Text = "Số quyết định:";
            this.lcPerson.Location = new Point(0x161, 0x152);
            this.lcPerson.Name = "lcPerson";
            this.lcPerson.Size = new Size(80, 13);
            this.lcPerson.TabIndex = 11;
            this.lcPerson.Text = "Người ban h\x00e0nh:";
            this.cboDecideNumber.Location = new Point(0x59, 0x14f);
            this.cboDecideNumber.Name = "cboDecideNumber";
            this.cboDecideNumber.Size = new Size(0x55, 20);
            this.cboDecideNumber.TabIndex = 8;
            this.cboPerson.Location = new Point(0x1b4, 0x14f);
            this.cboPerson.Name = "cboPerson";
            this.cboPerson.Size = new Size(0x97, 20);
            this.cboPerson.TabIndex = 12;
            this.txtReason.Location = new Point(0x59, 0x11c);
            this.txtReason.Name = "txtReason";
            this.txtReason.Size = new Size(0x1f2, 0x27);
            this.txtReason.TabIndex = 6;
            this.colEmployeeCode.Caption = "M\x00e3 nh\x00e2n vi\x00ean";
            this.colEmployeeCode.FieldName = "EmployeeCode";
            this.colEmployeeCode.Name = "colEmployeeCode";
            this.colEmployeeCode.Visible = true;
            this.colEmployeeCode.VisibleIndex = 0;
            this.colFirstName.Caption = "Họ l\x00f3t";
            this.colFirstName.FieldName = "FirstName";
            this.colFirstName.Name = "colFirstName";
            this.colFirstName.Visible = true;
            this.colFirstName.VisibleIndex = 1;
            this.colLastName.Caption = "T\x00ean";
            this.colLastName.FieldName = "LastName";
            this.colLastName.Name = "colLastName";
            this.colLastName.Visible = true;
            this.colLastName.VisibleIndex = 2;
            this.colRankCode.Caption = "M\x00e3 Ngạch";
            this.colRankCode.FieldName = "RankCode";
            this.colRankCode.Name = "colRankCode";
            this.colRankCode.Visible = true;
            this.colRankCode.VisibleIndex = 0;
            this.colRankName.Caption = "T\x00ean Ngạch";
            this.colRankName.FieldName = "RankName";
            this.colRankName.Name = "colRankName";
            this.colRankName.Visible = true;
            this.colRankName.VisibleIndex = 1;
            this.gridColumn1.Caption = "M\x00e3 Ngạch";
            this.gridColumn1.FieldName = "RankCode";
            this.gridColumn1.Name = "gridColumn1";
            this.gridColumn1.Visible = true;
            this.gridColumn1.VisibleIndex = 0;
            this.gridColumn2.Caption = "T\x00ean Ngạch";
            this.gridColumn2.FieldName = "RankName";
            this.gridColumn2.Name = "gridColumn2";
            this.gridColumn2.Visible = true;
            this.gridColumn2.VisibleIndex = 1;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.grInformation);
            base.Name = "xucSalaryAdd";
            base.Size = new Size(0x257, 0x198);
            base.Controls.SetChildIndex(base.btnCancel, 0);
            base.Controls.SetChildIndex(base.btnSave, 0);
            base.Controls.SetChildIndex(base.btnSaveNew, 0);
            base.Controls.SetChildIndex(this.grInformation, 0);
            ((ISupportInitialize) base.Err).EndInit();
            base.imageCollection2.EndInit();
            this.grInformation.EndInit();
            this.grInformation.ResumeLayout(false);
            this.grInformation.PerformLayout();
            this.txtEmployeeName.Properties.EndInit();
            this.glkEmployeeCode.Properties.EndInit();
            this.gridLookUpEdit1View.EndInit();
            this.dtDate.Properties.VistaTimeProperties.EndInit();
            this.dtDate.Properties.EndInit();
            this.grNew.ResumeLayout(false);
            this.grNew.PerformLayout();
            this.calInsuranceSalary.Properties.EndInit();
            this.calPayMoney.Properties.EndInit();
            this.cboPayForm.Properties.EndInit();
            this.calMinimumSalary.Properties.EndInit();
            this.calBasicSalary.Properties.EndInit();
            this.calCoefficient.Properties.EndInit();
            this.glkRankSalary.Properties.EndInit();
            this.gridView7.EndInit();
            this.cboStepSalary.Properties.EndInit();
            this.grOld.ResumeLayout(false);
            this.grOld.PerformLayout();
            this.calOldInsuranceSalary.Properties.EndInit();
            this.calOldPayMoney.Properties.EndInit();
            this.cboOldPayForm.Properties.EndInit();
            this.calOldMinimumSalary.Properties.EndInit();
            this.calOldBasicSalary.Properties.EndInit();
            this.calOldCoefficientSalary.Properties.EndInit();
            this.glkOldRankSalary.Properties.EndInit();
            this.gridView1.EndInit();
            this.cboOldStepSalary.Properties.EndInit();
            this.cboDecideNumber.Properties.EndInit();
            this.cboPerson.Properties.EndInit();
            this.txtReason.Properties.EndInit();
            base.ResumeLayout(false);
        }

        private void InitMultiLanguages()
        {
            this.grInformation.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "grInformation", this.grInformation.Text);
            this.grOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "grOld", this.grOld.Text);
            this.grNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "grNew", this.grNew.Text);
            this.lcRankOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "OldRankSalary", this.lcRankOld.Text);
            this.lcStepOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "OldStepSalary", this.lcStepOld.Text);
            this.lcCoefficientOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "OldCoefficientSalary", this.lcCoefficientOld.Text);
            this.lcMinimumSalaryOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "OldMinimumSalary", this.lcMinimumSalaryOld.Text);
            this.lcBasicSalaryOld.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "OldBasicSalary", this.lcBasicSalaryOld.Text);
            this.lcRankNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "NewRankSalary", this.lcRankNew.Text);
            this.lcStepNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "NewStepSalary", this.lcStepNew.Text);
            this.lcCoefficientNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "NewCoefficientSalary", this.lcCoefficientNew.Text);
            this.lcMinimumSalaryNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "NewMinimumSalary", this.lcMinimumSalaryNew.Text);
            this.lcBasicSalaryNew.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "NewBasicSalary", this.lcBasicSalaryNew.Text);
            this.lcReason.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "Reason", this.lcReason.Text);
            this.lcDate.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "Date", this.lcDate.Text);
            this.lcDecideNumber.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "DecideNumber", this.lcDecideNumber.Text);
            this.lcPerson.Text = MultiLanguages.GetString("tbl_ProcessSalaryAdd", "Person", this.lcPerson.Text);
        }

        private void labelControl7_Click(object sender, EventArgs e)
        {
        }

        private void LoadEmployeeInformation()
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(this.m_EmployeeCode);
            this.grInformation.Text = "Th\x00f4ng Tin Thay Đổi Điều Chỉnh Lương - " + hrm_employee.EmployeeCode + " (" + hrm_employee.FirstName + " " + hrm_employee.LastName + ")";
            this.txtEmployeeName.Text = hrm_employee.FirstName + " " + hrm_employee.LastName;
        }

        private void LoadEmployeeSalary()
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(this.m_EmployeeCode);
            this.cboOldPayForm.SelectedIndex = hrm_employee.PayForm;
            this.calOldPayMoney.EditValue = hrm_employee.PayMoney;
            this.glkOldRankSalary.EditValue = hrm_employee.RankSalary;
            this.cboOldStepSalary.Text = hrm_employee.StepSalary.ToString();
            this.calOldCoefficientSalary.EditValue = hrm_employee.CoefficientSalary;
            this.calOldMinimumSalary.EditValue = hrm_employee.MinimumSalary;
            this.calOldBasicSalary.EditValue = hrm_employee.BasicSalary;
            this.calOldInsuranceSalary.EditValue = hrm_employee.InsuranceSalary;
            this.cboPayForm.SelectedIndex = hrm_employee.PayForm;
            this.calPayMoney.EditValue = hrm_employee.PayMoney;
            this.glkRankSalary.EditValue = hrm_employee.RankSalary;
            this.cboStepSalary.Text = hrm_employee.StepSalary.ToString();
            this.calCoefficient.EditValue = hrm_employee.CoefficientSalary;
            this.calMinimumSalary.EditValue = hrm_employee.MinimumSalary;
            this.calBasicSalary.EditValue = hrm_employee.BasicSalary;
            this.calInsuranceSalary.EditValue = hrm_employee.InsuranceSalary;
        }

        private void RaiseSuccessEventHander(HRM_PROCESS_SALARY item)
        {
            if (this.Success != null)
            {
                this.Success(this, item);
            }
        }

        public void SetCode(string EmployeeCode)
        {
            this.m_EmployeeCode = EmployeeCode;
            if (this.m_EmployeeCode != "")
            {
                this.glkEmployeeCode.EditValue = this.m_EmployeeCode;
                this.LoadEmployeeInformation();
            }
        }

        public void SetData(HRM_PROCESS_SALARY item)
        {
            this.m_SalaryID = item.SalaryID;
            SYS_LOG.Insert("Tai Nạn Lao Động", "Xem", this.m_SalaryID.ToString());
            this.m_EmployeeCode = item.EmployeeCode;
            this.glkEmployeeCode.EditValue = this.m_EmployeeCode;
            this.glkEmployeeCode.Enabled = false;
            this.InitComponent();
            this.cboOldPayForm.SelectedIndex = item.OldPayForm;
            this.calOldPayMoney.EditValue = item.OldPayMoney;
            this.glkOldRankSalary.EditValue = item.OldRankSalary;
            this.cboOldStepSalary.Text = item.OldStepSalary.ToString();
            this.calOldCoefficientSalary.EditValue = item.OldCoefficientSalary;
            this.calOldMinimumSalary.EditValue = item.OldMinimumSalary;
            this.calOldBasicSalary.EditValue = item.OldBasicSalary;
            this.calOldInsuranceSalary.EditValue = item.OldInsuranceSalary;
            this.cboPayForm.SelectedIndex = item.NewPayForm;
            this.calPayMoney.EditValue = item.NewPayMoney;
            this.glkRankSalary.EditValue = item.NewRankSalary;
            this.cboStepSalary.Text = item.NewStepSalary.ToString();
            this.calCoefficient.EditValue = item.NewCoefficientSalary;
            this.calMinimumSalary.EditValue = item.NewMinimumSalary;
            this.calBasicSalary.EditValue = item.NewBasicSalary;
            this.calInsuranceSalary.EditValue = item.NewInsuranceSalary;
            this.dtDate.DateTime = item.Date;
            this.txtReason.Text = item.Reason;
            this.cboDecideNumber.Text = item.DecideNumber;
            this.cboPerson.Text = item.Person;
            this.LoadEmployeeInformation();
        }

        protected override string uc_Change()
        {
            return string.Empty;
        }

        protected override string uc_Delete()
        {
            HRM_PROCESS_SALARY item = new HRM_PROCESS_SALARY {
                SalaryID = this.m_SalaryID
            };
            string str = item.Delete();
            if (str == "OK")
            {
                this.RaiseSuccessEventHander(item);
            }
            return str;
        }

        protected override string uc_Save()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiProcessSalary") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowAdd)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Tai Nạn Lao Động", "Th\x00eam", this.m_SalaryID.ToString());
            base.SetWaitDialogCaption("Đang lưu dữ liệu...");
            Cursor.Current = Cursors.WaitCursor;
            HRM_PROCESS_SALARY item = new HRM_PROCESS_SALARY {
                SalaryID = Guid.NewGuid(),
                EmployeeCode = this.m_EmployeeCode,
                OldPayForm = this.cboOldPayForm.SelectedIndex,
                OldPayMoney = decimal.Parse(this.calOldPayMoney.EditValue.ToString()),
                OldRankSalary = this.glkOldRankSalary.EditValue.ToString(),
                OldStepSalary = int.Parse(this.cboOldStepSalary.Text),
                OldCoefficientSalary = double.Parse(this.calOldCoefficientSalary.EditValue.ToString()),
                OldMinimumSalary = decimal.Parse(this.calOldMinimumSalary.EditValue.ToString()),
                OldBasicSalary = decimal.Parse(this.calOldBasicSalary.EditValue.ToString()),
                OldInsuranceSalary = decimal.Parse(this.calOldInsuranceSalary.EditValue.ToString()),
                NewPayForm = this.cboPayForm.SelectedIndex,
                NewPayMoney = decimal.Parse(this.calPayMoney.EditValue.ToString()),
                NewRankSalary = this.glkRankSalary.EditValue.ToString(),
                NewStepSalary = int.Parse(this.cboStepSalary.Text),
                NewCoefficientSalary = double.Parse(this.calCoefficient.EditValue.ToString()),
                NewMinimumSalary = decimal.Parse(this.calMinimumSalary.EditValue.ToString()),
                NewBasicSalary = decimal.Parse(this.calBasicSalary.EditValue.ToString()),
                NewInsuranceSalary = decimal.Parse(this.calInsuranceSalary.EditValue.ToString()),
                Date = this.dtDate.DateTime,
                Reason = this.txtReason.Text,
                DecideNumber = this.cboDecideNumber.Text,
                Person = this.cboPerson.Text
            };
            string text = item.Insert();
            if (text == "OK")
            {
                this.RaiseSuccessEventHander(item);
            }
            Cursor.Current = Cursors.Default;
            this.DoHide();
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                this.Update(item.NewPayForm, item.NewPayMoney, item.NewRankSalary, item.NewStepSalary, item.NewCoefficientSalary, item.NewMinimumSalary, item.NewBasicSalary, item.NewInsuranceSalary, item.Date);
            }
            return text;
        }

        protected override string uc_Update()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiProcessSalary") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowEdit)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Tai Nạn Lao Động", "Cập Nhật", this.m_SalaryID.ToString());
            base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
            HRM_PROCESS_SALARY item = new HRM_PROCESS_SALARY {
                SalaryID = this.m_SalaryID,
                EmployeeCode = this.m_EmployeeCode,
                OldPayForm = this.cboOldPayForm.SelectedIndex,
                OldPayMoney = decimal.Parse(this.calOldPayMoney.EditValue.ToString()),
                OldRankSalary = this.glkOldRankSalary.EditValue.ToString(),
                OldStepSalary = int.Parse(this.cboOldStepSalary.Text),
                OldCoefficientSalary = double.Parse(this.calOldCoefficientSalary.EditValue.ToString()),
                OldMinimumSalary = decimal.Parse(this.calOldMinimumSalary.EditValue.ToString()),
                OldBasicSalary = decimal.Parse(this.calOldBasicSalary.EditValue.ToString()),
                OldInsuranceSalary = decimal.Parse(this.calOldInsuranceSalary.EditValue.ToString()),
                NewPayForm = this.cboPayForm.SelectedIndex,
                NewPayMoney = decimal.Parse(this.calPayMoney.EditValue.ToString()),
                NewRankSalary = this.glkRankSalary.EditValue.ToString(),
                NewStepSalary = int.Parse(this.cboStepSalary.Text),
                NewCoefficientSalary = double.Parse(this.calCoefficient.EditValue.ToString()),
                NewMinimumSalary = decimal.Parse(this.calMinimumSalary.EditValue.ToString()),
                NewBasicSalary = decimal.Parse(this.calBasicSalary.EditValue.ToString()),
                NewInsuranceSalary = decimal.Parse(this.calInsuranceSalary.EditValue.ToString()),
                Date = this.dtDate.DateTime,
                Reason = this.txtReason.Text,
                DecideNumber = this.cboDecideNumber.Text,
                Person = this.cboPerson.Text
            };
            string text = item.Update();
            if (text == "OK")
            {
                this.RaiseSuccessEventHander(item);
            }
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                this.Update(item.NewPayForm, item.NewPayMoney, item.NewRankSalary, item.NewStepSalary, item.NewCoefficientSalary, item.NewMinimumSalary, item.NewBasicSalary, item.NewInsuranceSalary, item.Date);
            }
            this.DoHide();
            return text;
        }

        private void Update(int PayForm, decimal PayMoney, string RankSalary, int StepSalary, double CoefficientSalary, decimal MinimumSalary, decimal BasicSalary, decimal InsuranceSalary, DateTime Date)
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(this.m_EmployeeCode);
            hrm_employee.PayForm = PayForm;
            hrm_employee.PayMoney = PayMoney;
            hrm_employee.RankSalary = RankSalary;
            hrm_employee.StepSalary = StepSalary;
            hrm_employee.CoefficientSalary = CoefficientSalary;
            hrm_employee.MinimumSalary = MinimumSalary;
            hrm_employee.BasicSalary = BasicSalary;
            hrm_employee.InsuranceSalary = InsuranceSalary;
            if (Date >= hrm_employee.DateSalary)
            {
                hrm_employee.DateSalary = Date;
            }
            hrm_employee.Update();
        }

        public delegate void SuccessEventHander(object sender, HRM_PROCESS_SALARY item);
    }
}

